package cn.sdhuijin.healthexam.activity;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.View.OnClickListener;
import cn.sdhuijin.healthexam.ExitApplication;
import cn.sdhuijin.healthexam.R;
import cn.sdhuijin.healthexam.control.AbstractControlActivity;

/**
 * 产后四十二天随访详情
 * 
 * @author sunping
 */
public class ChanHouSiShiErInfoActivity extends AbstractControlActivity
		implements OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_chanhou_sishier_info);
		ExitApplication.getInstance().addActivity(this);

		Intent intent = getIntent();
		// 获取传递过来的sql语句
		String fileName = intent.getStringExtra("filename");

		addTextView(R.id.txt_name, "姓名");
		addTextView(R.id.txt_identify_num, "身份证号");
		addTextView(R.id.txt_jiankangqingkuang, "一般健康情况");
		addTextView(R.id.txt_xinlizhuangkaung, "一般心理状况");
		addTextView(R.id.txt_blood_pressure_gao, "高压");
		addTextView(R.id.txt_blood_pressure_di, "低压");
		addTextView(R.id.txt_rufang, "乳房_content");
		addTextView(R.id.txt_rufang_ycsm, "乳房异常");
		addTextView(R.id.txt_elou, "恶露_content");
		addTextView(R.id.txt_elou_ycsm, "恶露异常");
		addTextView(R.id.txt_zigong, "子宫_content");
		addTextView(R.id.txt_zigong_ycsm, "子宫异常");
		addTextView(R.id.txt_shangkou, "伤口_content");
		addTextView(R.id.txt_shangkou_ycsm, "伤口异常");
		addTextView(R.id.txt_qt, "其他");
		addTextView(R.id.txt_fenlei, "分类_content");
		addTextView(R.id.txt_fenlei_ycsm, "分类未恢复");
		addTextView(R.id.txt_jkzd, "指导_content");
		addTextView(R.id.txt_jkzd_qt, "其它指导");
		addTextView(R.id.txt_zhuanzhen, "处理_content");
		addTextView(R.id.txt_zhuanzhen_yy, "转诊原因");
		addTextView(R.id.txt_zhuanzhen_jgjks, "机构及科室");
		addTextView(R.id.txt_visit_doctor, "随访医生签名");
		addTextView(R.id.txt_suggestion, "指导意见");

		setButtonListener(this, R.id.btn_back);

		Properties prop = new Properties();
		try {
			File f = new File(Environment.getExternalStorageDirectory()
					.getPath() + "/health/" + fileName + ".txt");
			if (f.exists()) {

				controlManager.setPropertiesPath(f.getAbsolutePath());
				controlManager.toControl();

				prop.load(new FileReader(f.getAbsolutePath()));
			} else {
				this.toastInformation(R.string.record_deleted);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void onClick(View v) {
		int clickId = (Integer) v.getId();
		switch (clickId) {
		case R.id.btn_back:
			finish();
			break;
		default:
			break;
		}
	}
}